home *** CD-ROM | disk | FTP | other *** search
/ SGI Origin & Onyx2 Patches 1998 May / Origin and Onyx2 System Disk Patches May 1998.img / dist / patchSG0002839.idb / usr / include / sys / graph.h.z / graph.h
C/C++ Source or Header  |  1998-04-01  |  5KB  |  125 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *               Copyright (C) 1992-1995 Silicon Graphics, Inc.           *
  4.  *                                                                        *
  5.  *  These coded instructions, statements, and computer programs  contain  *
  6.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10.  *                                                                        *
  11.  **************************************************************************/
  12. #ifndef _GRAPH_H
  13. #define _GRAPH_H
  14.  
  15. #ident    "$Revision: 1.8 $"
  16.  
  17. #if _KERNEL || _USER_MODE_TEST
  18.  
  19. /* 
  20. ** Maximum number of characters in a label, including a terminating 
  21. ** null character.
  22. */
  23. #define LABEL_LENGTH_MAX 256 
  24.  
  25. /*
  26. ** Public interfaces to graph module.
  27. */
  28. typedef long        arbitrary_info_t;
  29. typedef struct graph_s    *graph_hdl_t;
  30. typedef long        graph_edge_place_t;
  31. typedef long        graph_info_place_t;
  32. typedef long        graph_vertex_place_t;
  33.  
  34. /*
  35. ** Possible return values from graph routines.
  36. */
  37. typedef enum graph_error_e {    GRAPH_SUCCESS,        /* 0 */
  38.                 GRAPH_DUP,        /* 1 */
  39.                 GRAPH_NOT_FOUND,    /* 2 */
  40.                 GRAPH_BAD_PARAM,    /* 3 */
  41.                 GRAPH_HIT_LIMIT,    /* 4 */
  42.                 GRAPH_CANNOT_ALLOC,    /* 5 */
  43.                 GRAPH_ILLEGAL_REQUEST,    /* 6 */
  44.                 GRAPH_IN_USE        /* 7 */
  45.                 } graph_error_t;
  46.  
  47. typedef struct graph_attr {
  48.     /* INPUT TO graph_create */
  49.     char    *ga_name;        /* name of graph                 */
  50.  
  51.     char    ga_separator;        /* separator char - (e.g. '/')             */
  52.  
  53.     int    ga_num_index;        /* number of indexed infos per vertex         */
  54.  
  55.     int    ga_reserved_places;    /* reserved edge/info "place" handles         */
  56.                     /* starting with handle=1.  Graph code will     */
  57.                     /* avoid using 1..ga_reserved_places as     */
  58.                     /* edge/info handles                */
  59.  
  60.     /* ADDITIONAL FIELDS RETURNED FROM graph_summary_get */
  61.     long    ga_generation;        /* generation number.  Incremented every     */
  62.                     /* time any change is made to the graph.     */
  63.  
  64.     int    ga_num_vertex;        /* count of the current number of vertices     */
  65.                     /* in this graph.                */
  66.  
  67.     int    ga_num_vertex_max;    /* maximum number of vertices supported        */
  68. } graph_attr_t;
  69.  
  70. #define GRAPH_VERTEX_NONE ((vertex_hdl_t)-1)
  71. #define GRAPH_EDGE_PLACE_NONE ((graph_edge_place_t)0)
  72. #define GRAPH_INFO_PLACE_NONE ((graph_info_place_t)0)
  73. #define GRAPH_VERTEX_PLACE_NONE ((graph_vertex_place_t)0)
  74.  
  75. /* Operations on GRAPHS: create, destroy, summary_get, visit */
  76. #if _STANDALONE
  77. extern graph_error_t graph_create(graph_attr_t *, graph_hdl_t *);
  78. #else
  79. extern graph_error_t graph_create(graph_attr_t *, graph_hdl_t *, int);
  80. #endif
  81. extern graph_error_t graph_destroy(graph_hdl_t);
  82. extern graph_error_t graph_summary_get(graph_hdl_t, graph_attr_t *);
  83. extern graph_error_t graph_vertex_visit(graph_hdl_t, int (*)(void *, vertex_hdl_t), void *, int *, vertex_hdl_t *);
  84.  
  85. /* Operations on VERTICES: create, destroy, combine, clone, get_next, ref, unref */
  86. extern graph_error_t graph_vertex_create(graph_hdl_t, vertex_hdl_t *);
  87. extern graph_error_t graph_vertex_destroy(graph_hdl_t, vertex_hdl_t);
  88. #if NOTDEF
  89. extern graph_error_t graph_vertex_combine(graph_hdl_t, vertex_hdl_t, vertex_hdl_t);
  90. #endif /* NOTDEF */
  91. extern graph_error_t graph_vertex_clone(graph_hdl_t, vertex_hdl_t, vertex_hdl_t *);
  92. extern graph_error_t graph_vertex_get_next(graph_hdl_t, vertex_hdl_t *, graph_vertex_place_t *);
  93. extern graph_error_t graph_vertex_ref(graph_hdl_t, vertex_hdl_t);
  94. extern graph_error_t graph_vertex_unref(graph_hdl_t, vertex_hdl_t);
  95.  
  96. /* Operations on EDGES: add, remove, get_next */
  97. extern graph_error_t graph_edge_add(graph_hdl_t, vertex_hdl_t, vertex_hdl_t, char *);
  98. extern graph_error_t graph_edge_remove(graph_hdl_t, vertex_hdl_t, char *, vertex_hdl_t *);
  99. extern graph_error_t graph_edge_get(graph_hdl_t, vertex_hdl_t, char *, vertex_hdl_t *);
  100. extern graph_error_t graph_edge_get_next(graph_hdl_t, vertex_hdl_t, char *, vertex_hdl_t *, graph_edge_place_t *);
  101.  
  102. /* Operations on LABELLED INFORMATION: add, remove, replace, get, get_next */
  103. typedef uintptr_t arb_info_desc_t; /* Abstract descriptor for arbitrary_info_t */
  104. extern graph_error_t graph_info_add_LBL(graph_hdl_t, vertex_hdl_t, char *, arb_info_desc_t, arbitrary_info_t);
  105.  
  106. extern graph_error_t graph_info_remove_LBL(graph_hdl_t, vertex_hdl_t, char *, arb_info_desc_t *, arbitrary_info_t *);
  107.  
  108. extern graph_error_t graph_info_replace_LBL(graph_hdl_t, vertex_hdl_t, char *, 
  109.             arb_info_desc_t, arbitrary_info_t, arb_info_desc_t *, arbitrary_info_t *);
  110.  
  111. extern graph_error_t graph_info_get_LBL(graph_hdl_t, vertex_hdl_t, char *, arb_info_desc_t *, arbitrary_info_t *);
  112.  
  113. extern graph_error_t graph_info_get_next_LBL(graph_hdl_t, vertex_hdl_t, char *, 
  114.             arb_info_desc_t *, arbitrary_info_t *, graph_info_place_t *);
  115.  
  116. /* Operations on INDEXED INFORMATION: replace, get */
  117. extern graph_error_t graph_info_replace_IDX(graph_hdl_t, vertex_hdl_t, unsigned int, arbitrary_info_t, arbitrary_info_t *);
  118. extern graph_error_t graph_info_get_IDX(graph_hdl_t, vertex_hdl_t, unsigned int, arbitrary_info_t *);
  119.  
  120. /* Operations on paths: get_component */
  121. extern graph_error_t graph_path_get_component(graph_hdl_t, char *, char *, int *, int *);
  122. #endif /* _KERNEL || _USER_MODE_TEST */
  123.  
  124. #endif /* _GRAPH_H */
  125.